﻿using System;

public class MinesweeperMain
{
    static void Main()
    {
        Console.CursorVisible = false;

        IRenderer renderer = new ConsoleRenderer();
        IUserInterface keyboard = new KeyboardInput();
        GameBoard gameBoard = new GameBoard();
        Player player = new Player(new Coords2D(gameBoard.Rows / 2 - 1, gameBoard.Cols / 2 - 1));

        Engine gameEngine = new Engine(renderer, keyboard, gameBoard, player);

        keyboard.OnLeftPressed += (sender, eventInfo) =>
        {
            gameEngine.MovePlayerLeft();
        };

        keyboard.OnUpPressed += (sender, eventInfo) =>
        {
            gameEngine.MovePlayerUp();
        };

        keyboard.OnRightPressed += (sender, eventInfo) =>
        {
            gameEngine.MovePlayerRight();
        };

        keyboard.OnDownPressed += (sender, eventInfo) =>
        {
            gameEngine.MovePlayerDown();
        };

        keyboard.OnOpenPressed += (sender, eventInfo) =>
        {
            gameEngine.OpenSquare();
        };

        keyboard.OnMarkPressed += (sender, eventInfo) =>
        {
            gameEngine.MarkAsMine();
        };

        gameEngine.Run();
    }
}
